package com.finalproject.endice9x9;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.widget.TextView;

//Information dialog fragment 
//Takes two parameters: dialog title and dialog content from resources
public class InfoFragment extends DialogFragment {
	private int resIdTitle;
	private int resIdText;
	
	public static final String DIALOG_INFO = "info";
	
	
	public InfoFragment(int resIdTitle, int resIdText) {
		this.resIdTitle = resIdTitle;
		this.resIdText = resIdText;
	}

	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		View v = getActivity().getLayoutInflater().inflate(R.layout.fragment_info_title, null);
		setRetainInstance(true);
		
		TextView editInfo = (TextView)v.findViewById(R.id.editInfo);
		editInfo.setText(resIdText);	
		editInfo.setMovementMethod(new ScrollingMovementMethod());
		
		return new AlertDialog.Builder(getActivity())
			.setView(v)
			.setTitle(resIdTitle)
			.setPositiveButton(android.R.string.ok, null)
			.create();
	}
}
